package com.simon.factorymethodpattern;


/**
 * 创建型模式
 * 创建与对象的使用分离
 * 接口
 * WWW
 * what建什么  who谁来建   when什么时候建
 * 隐藏创建细节
 * @author KZSIMON
 *
 */
public class ClientClass {
	public static void main(String[] args) {
		Factory factory = new AFactory();
		//Factory factory = (Factory)XMLUtil.getBeans();
		Fruit fruit = factory.CreateFruit();
		fruit.eat();
	}
	public String factory(String fruitName) {
		if(fruitName.equals("Apple"))
			return "Apple";
		if(fruitName.equals("Banana"))
			return "Banana";
		return null;
	}
}
